package com.wisely.highlight_spring4.ch3.aware;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class AppAware implements ApplicationContextAware
{

	private ApplicationContext applicationContext;
	
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
	{
		this.applicationContext = applicationContext;
	}

	public void lala(){
		String applicationName = applicationContext.getApplicationName();
		Environment environment = applicationContext.getEnvironment();
		
		System.out.println(applicationName + " lala");
		System.out.println(environment);
	}

}
